package com.yc.damai.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.yc.damai.entity.DmProduct;
import com.yc.damai.mapper.DmProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 大麦商城-商品表-73 前端控制器
 * </p>
 *
 * @author ly
 * @since 2024-09-23
 */
@RestController
@RequestMapping("dmProduct")
public class DmProductController {

    @Autowired
    DmProductMapper productMapper;

    @RequestMapping("queryHots")
    List<DmProduct> queryHots(){
        Page<DmProduct> page = new PageDTO<>(1,10);
        LambdaQueryWrapper<DmProduct> lqw = new LambdaQueryWrapper<>();
        lqw.eq(DmProduct::getIsHot, 1);
        page = productMapper.selectPage(page, lqw);
        return page.getRecords();
    }


}
